//
//  WPDrawCashViewController.m
//  ZhongChouPingTai
//
//  Created by WeiPan on 16/4/1.
//  Copyright © 2016年 HuaYiSoftware. All rights reserved.
//

#import "WPDrawCashViewController.h"

@interface WPDrawCashViewController ()
@property (nonatomic, strong) UITextField * moneyCountText;/**< 可提现金额 */
@property (nonatomic, strong) UITextField * topupTextField;/**< 提现金额 */
@property (nonatomic, strong) UILabel * introLabel;/**< 提现说明 */
@property (nonatomic, strong) UIButton * drawCashBtn;/**< 提现按钮 */
- (void)initializeUserInterface; /**< 初始化用户界面 */


@end

@implementation WPDrawCashViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initializeUserInterface];
}
#pragma mark - init
- (void)initializeUserInterface {
    [self.view addSubview:self.moneyCountText];
    [self.view addSubview:self.topupTextField];
    [self.view addSubview:self.introLabel];
    [self.view addSubview:self.drawCashBtn];
}
#pragma mark - responds events
- (void)respondsToDrawCashBtn {
    
}
#pragma mark - getter
- (UITextField *)moneyCountText {
    if (!_moneyCountText) {
        _moneyCountText = ({
            UITextField * text = [[UITextField alloc]initWithFrame:CGRectMake(0, navBar_Fheight+10*DHFlexibleHorizontalMutiplier(), SCREEN_SIZE.width, 45*DHFlexibleHorizontalMutiplier())];
            UIView * leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 100, 40) adjustWidth:NO];
            UILabel * lab = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, 90, 40) adjustWidth:NO];
            [leftView addSubview:lab];
            text.leftViewMode = UITextFieldViewModeAlways;
            text.leftView = leftView;
            lab.text = @"可提金额";
            lab.font = [UIFont boldSystemFontOfSize:14*DHFlexibleHorizontalMutiplier()];
            lab.textColor = COLOR_RGB(141, 141, 141, 1);
            text.backgroundColor = [UIColor whiteColor];
            text.font = [UIFont systemFontOfSize:12*DHFlexibleHorizontalMutiplier()];
            text.textColor = COLOR_RGB(253, 144, 0, 1);
            UIView * lineUp = [[UIView alloc]initWithFrame:CGRectMake(0, 1, SCREEN_SIZE.width, 1)];
            lineUp.backgroundColor = COLOR_RGB(141, 141, 141, 1);
            [text addSubview:lineUp];
            UIView * lineDown = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetHeight(text.bounds)-1, SCREEN_SIZE.width, 1)];
            lineDown.backgroundColor = COLOR_RGB(141, 141, 141, 1);
            [text addSubview:lineDown];
            text.text = @"¥0";
            text.userInteractionEnabled = NO;
            text;
        });
    }
    return _moneyCountText;
}
- (UITextField *)topupTextField {
    if (!_topupTextField) {
        _topupTextField = ({
            UITextField * text = [[UITextField alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(self.moneyCountText.frame), SCREEN_SIZE.width, 40)];
            UIView * leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 100, 40) adjustWidth:NO];
            UILabel * lab = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, 90, 40) adjustWidth:NO];
            [leftView addSubview:lab];
            text.leftViewMode = UITextFieldViewModeAlways;
            text.leftView = leftView;
            lab.text = @"金额(元)";
            lab.font = [UIFont boldSystemFontOfSize:14*DHFlexibleHorizontalMutiplier()];
            lab.textColor = COLOR_RGB(141, 141, 141, 1);
            text.backgroundColor = [UIColor whiteColor];
            text.font = [UIFont systemFontOfSize:12*DHFlexibleHorizontalMutiplier()];
            text.textColor = COLOR_RGB(253, 144, 0, 1);
            UIView * lineDown = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetHeight(text.bounds)-1, SCREEN_SIZE.width, 1)];
            lineDown.backgroundColor = COLOR_RGB(141, 141, 141, 1);
            [text addSubview:lineDown];
            text.placeholder = @"请输入提现金额";
            text.keyboardType = UIKeyboardTypeDecimalPad;
            text.clearButtonMode = UITextFieldViewModeWhileEditing;
            text;
        });
    }
    return _topupTextField;
}
- (UILabel *)introLabel {
    if (!_introLabel) {
        _introLabel = ({
            UILabel * lab = [[UILabel alloc]initWithFrame:CGRectMake(10*DHFlexibleHorizontalMutiplier(), CGRectGetMaxY(self.topupTextField.frame), 300*DHFlexibleHorizontalMutiplier(), 40*DHFlexibleHorizontalMutiplier())];
            lab.textColor = COLOR_RGB(141, 141, 141, 1);
            lab.text = @"提现至您最近用于支付或充值的支付宝";
            lab;
        });
    }
    return _introLabel;
}
- (UIButton *)drawCashBtn {
    if (!_drawCashBtn) {
        _drawCashBtn = ({
            UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
            btn.frame = CGRectMake(10*DHFlexibleHorizontalMutiplier(), CGRectGetMaxY(self.introLabel.frame) + 40*DHFlexibleHorizontalMutiplier(), 300*DHFlexibleHorizontalMutiplier(), 30*DHFlexibleHorizontalMutiplier());
            btn.backgroundColor = COLOR_RGB(234, 27, 47, 1);
            btn.layer.cornerRadius = 15*DHFlexibleHorizontalMutiplier();
            btn.titleLabel.font = [UIFont systemFontOfSize:13*DHFlexibleHorizontalMutiplier()];
            [btn setTitle:@"确定提现" forState:UIControlStateNormal];
            [btn addTarget:self action:@selector(respondsToDrawCashBtn) forControlEvents:UIControlEventTouchUpInside];
            btn;
        });
    }
    return _drawCashBtn;
}

@end
